#include<iostream>
using namespace std;
int main()
{
	int k;
	cin >> k;
	int sum_1, sum_5, sum_10;
	sum_5 = sum_1 = sum_10 = 0;
	for (int i = 0;i < k;i++)
	{
		int y;
		cin >> y;
		switch (y)
		{
			case 1:
				sum_1 += 1;
				break;
			case 5:
				sum_5 += 1;
				break;
			case 10:
				sum_10 += 1;
				break;
			default:
				break;
		}
	}
	cout << sum_1 << endl
		<< sum_5 << endl
		<< sum_10;
	return 0;
}